import numpy as np
import pygame
from pygame.locals import *
from player import Player
from partingLine import PartingLine
class Wall(object):
    def __init__(self,partingLine, color = (20, 20, 20)):
        self.partingLine = partingLine
        self.size = self.partingLine.size
        self.color = color
        self.walls = list()
    def getKey(self, key, player):
        if key[K_i] and player.positionConstraint():
            self.walls.append((player.position.x, player.position.y))
    def draw(self):
        for (i, j) in self.walls:
            x = i * self.size + self.partingLine.line_width
            y = j * self.size + self.partingLine.line_width
            l = self.size - self.partingLine.line_width
            pygame.draw.rect(self.partingLine.screen, self.color, (x, y, l, l), 0 )
    def save(self):
        print(np.array(self.walls))
        np.savetxt("walls.csv", np.array(self.walls), fmt = "%d")
        np.savetxt("../vertexes.csv", np.array(self.walls), fmt = "%d")
